package com.medusa.aps.business.modules.modeling.model.input;

import cn.hutool.core.util.StrUtil;
import com.medusa.aps.business.model.enums.AuxiliaryEnum;
import com.medusa.aps.business.model.enums.AuxiliaryStatus;
import com.medusa.aps.business.model.enums.SourceEnum;
import com.medusa.aps.business.model.pagination.Page;
import com.medusa.aps.business.modules.modeling.mp.entity.AuxiliaryData;
import com.medusa.aps.business.global.model.o.RangeDate;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class AuxiliaryDataParam extends Page<AuxiliaryData> {

    /**
     * 辅助资源编码
     */
    @Schema(description = "辅助资源编码")
    private String auxiliaryResourceCoding;

    /**
     * 辅助资源名称
     */
    @Schema(description = "辅助资源名称")
    private String auxiliaryResourceName;

    /**
     * 类型
     */
    @Schema(description = "类型")
    private AuxiliaryEnum type;

    /**
     * 状态
     */
    @Schema(description = "状态")
    private AuxiliaryStatus status;

    /**
     * 数据来源
     */
    @Schema(description = "数据来源")
    private SourceEnum dataSource;
    /**
     * 创建人
     */
    @Schema(description = "创建人")
    private String creator;
    /**
     * 创建日期
     */
    @Schema(description = "创建日期")
    private RangeDate createTime = new RangeDate();

    /**
     * 辅助资源id
     */
    @Schema(description = "辅助资源id")
    private List<Integer> ids;

    /**
     * 辅助编码集合
     */
    @Schema(description = "辅助编码集合")
    private List<String> auxiliaryResourceCodings;

    @SuppressWarnings(value = "unused")
    public void setAuxiliaryResourceCoding(String auxiliaryResourceCoding) {
        if (StrUtil.isEmpty(auxiliaryResourceCoding) || !auxiliaryResourceCoding.contains(StrUtil.COMMA)) {
            this.auxiliaryResourceCoding = auxiliaryResourceCoding;
            return;
        }
        this.auxiliaryResourceCodings = StrUtil.split(auxiliaryResourceCoding, StrUtil.COMMA);
    }
}
